Skip to content

Conversation

@pmalouin
Copy link
Contributor

@pmalouin pmalouin commented Oct 10, 2025

This PR introduces support for the connected accounts flow, enabling users to link third-party accounts (Google, Slack, GitHub) to their Auth0 user profile for seamless API access through Token Vault. The implementation includes significant documentation improvements, terminology updates, and bug fixes across multiple examples.

Key Changes:

  • Connected Accounts Flow: Added support for connecting third-party accounts via the Connect Account flow instead of the previous /authorize flow. This is support in both popup and redirect modes for the @auth0/ai-components package that covers the front-end component handling of the flow (paired with a Next.js/FastAPI backend).
  • Terminology Updates: Renamed "Resource Server Client" to "Custom API Client" throughout codebase for clarity and consistency with Auth0 terminology
  • My Account API Integration: Added support for Auth0's My Account API to initiate the connect account flow
  • Multi-Resource Refresh Token (MRRT): Implemented MRRT support to enable refresh tokens that work across multiple APIs (allows access to My Account API in this case)
  • Documentation Updates: Reviewed setup guides for tenant configuration, including revised steps for:
    • Custom API Client creation
    • My Account API access grants
    • MRRT policy configuration
    • Social connection setup with Token Vault

Technical Improvements:

  • Updated TokenVaultConsentPopup and TokenVaultConsentRedirect components to properly handle TokenVaultInterrupt's authorizationParams field (extra authorization parameters to be submitted to the 3rd party provider's authorization request)
  • Changed authorization endpoint from /auth/login to /auth/connect for connected accounts flow
  • Added enableConnectAccountEndpoint configuration flag when initializing the nextjs-auth0 library
  • Fixed scope handling to always include "openid" for Google
  • Updated environment variable naming for clarity (RESOURCE_SERVER_*AUTH0_CUSTOM_API_*)

Bug Fixes:

  • Fixed calendar availability check to use addDays instead of addHours for proper date range queries

Examples Updated:

  • examples/calling-apis/chatbot - All AI framework variants (AI SDK, Genkit, Langgraph, LlamaIndex)
  • examples/calling-apis/spa-with-backend-api/react-hono-ai-sdk
  • examples/calling-apis/spa-with-backend-api/react-langgraph-api

Testing

Manual Testing Required:

  • Verify connected accounts flow works correctly in popup and redirect modes
  • Test Token Vault token exchange with Custom API Client credentials
  • Confirm My Account API integration for creating connected accounts
  • Validate MRRT functionality across multiple APIs
  • Test with Google Calendar, Slack, and GitHub connections
  • Verify all examples run successfully with updated configuration

Environment Setup Testing:

  • Validate all README instructions are accurate and complete
  • Confirm environment variable renaming doesn't break existing setups
  • Test tenant configuration steps from scratch

Breaking Changes

⚠️ The @auth0/ai-components package was updated to trigger the new Connect Account flow instead of the previous flow via the /authorize entry point. As such, application builder will need to upgrade their application to support the new flow:

  • Next.js Applications: upgrade the @auth0/nextjs-auth0 library to v4.13.0
    • Set the enableConnectAccountEndpoint: true option when initializing the Auth0Client module.
  • SPA Applications: upgrade the @auth0/auth0-spa-js library to v2.9.0
    • Set these parameters when calling createAuth0Client()
  auth0Client = await createAuth0Client({
    ...
    useRefreshTokens: true,
    useMrrt: true,
    useDpop: true,
  });

⚠️ Environment Variable Renaming in the SPA examples:

  • RESOURCE_SERVER_CLIENT_ID → AUTH0_CUSTOM_API_CLIENT_ID
  • RESOURCE_SERVER_CLIENT_SECRET → AUTH0_CUSTOM_API_CLIENT_SECRET

Users will need to update their .env files when upgrading.

@priley86
Copy link
Contributor

priley86 commented Nov 4, 2025

  • verified both examples to work w/ my GenAI tenant locally
  • discussed upcoming changes in auth0 docs-v2 repo (captured in: https://auth0team.atlassian.net/browse/AIDX-240)
  • known limitation about loss of message history in Hono + React SPA example after step up flow is acceptable to the business as of now (and could be improved in future w/ popup flow vs redirect flow)

priley86
priley86 previously approved these changes Nov 4, 2025
- **Allowed Logout URLs**: `http://localhost:5173`
- **Allowed Web Origins**: `http://localhost:5173`
- Make sure to Allow Refresh Token in Grant Types under Advanced Settings but you can disable "Allow Refresh Token Rotation"
- Enable "Allow Refresh Token Rotation"
Copy link
Contributor

@priley86 priley86 Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's interesting here is that i've tested my SPA to work when it does have this setting (Allow Refresh Token Rotation) enabled, however on the Next.js chatbot example (and in that README here), we have it disabled. It's an interesting diff we should look into.

@priley86
Copy link
Contributor

  • tested react-langgraph-api flow to work as documented here
  • noted redirect behavior is less than ideal w/ existing step-up auth flow, and popup behavior is preferred. (scheduled for future improvements)

Changes look ready here and happy to approve after auth0 next.js + auth0 spa SDKs have been updated to target versions.

@pmalouin pmalouin marked this pull request as ready for review November 17, 2025 15:05
@pmalouin pmalouin merged commit 2e0ab20 into main Nov 19, 2025
2 checks passed
@pmalouin pmalouin deleted the connected-accounts branch November 19, 2025 13:18
@github-actions
Copy link

🎉 This PR is included in version @auth0/ai-v6.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions
Copy link

🎉 This PR is included in version @auth0/ai-components-v4.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions
Copy link

🎉 This PR is included in version @auth0/ai-genkit-v6.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions
Copy link

🎉 This PR is included in version @auth0/ai-langchain-v5.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions
Copy link

🎉 This PR is included in version @auth0/ai-llamaindex-v5.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions
Copy link

🎉 This PR is included in version @auth0/ai-vercel-v5.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants